GLOBAL
	string nextState;
	_interval next_state_frames;
END

FUNCTION string setState( string st, _interval* currentStateFrames, int* doLoop)
PRIVATE
	string currentState;
END
BEGIN
	SWITCH ( st )
		CASE IDLE:
			
			*currentStateFrames = IDLE_FRAMES;
			*doLoop = -1; // cantidad de veces q se hace la animacion, 0 ninguna, -1 infinito
		END 
		
		CASE WALKING:
			
			*currentStateFrames = WALKING_FRAMES;
			*doLoop = -1;
		END
		
		CASE JUMPING:
			
			*currentStateFrames = JUMPING_FRAMES;
			nextState = IDLE;
			next_state_frames = IDLE_FRAMES;
			*doLoop = 0;
		END
		
		CASE CROUCH:
			
			*currentStateFrames = CROUCH_FRAMES;
			*doLoop = 0;
		END
	END
	return currentState;
END 